home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / dosmon.arc / DOSMON.DB < prev    next >
Text File  |  1986-05-17  |  5KB  |  265 lines

  1. f100 500 0
  2. a100
  3. ;
  4. ;----------------------------------------
  5. ; DOSMON - DOS Activity Monitor
  6. ;----------------------------------------
  7. ;
  8. ; This program will terminate and stay resident.  It intercepts the
  9. ; DOS service interrupt and displays status information on the
  10. ; screen during DOS service execution periods.
  11. ;
  12. ; S.H.Smith, 15-may-86
  13. ;
  14.  
  15.  
  16. a100
  17. ;----------------------------------------
  18. ; startup entry point
  19. ;----------------------------------------
  20.    jmp 2e0       ;install
  21.  
  22.  
  23. a103
  24. ; vector for old interrupt
  25.    db 0,0,0,0
  26.  
  27.  
  28. a107
  29. ; segment address for display memory
  30. ; filled in by startup code
  31.    dw 0
  32.  
  33.  
  34. a10e
  35. ; twiddle display index
  36.    dw 0
  37.  
  38.  
  39. a110
  40. ; twiddle display characters
  41.    db "─\│/"
  42.  
  43.  
  44. a130
  45. ; a signature in bytes
  46.    db 0a,0d,'DOSMON - DOS Activity Monitor',0a,0d
  47.    db '$  S.H.Smith, 15-May-86',0a,0d
  48.    db 1a
  49.  
  50.  
  51. a170
  52. ;----------------------------------------
  53. ; new DOS service interrupt
  54. ;----------------------------------------
  55. ;
  56.    push ds
  57.    push es
  58.    push bx         ;save entry registers
  59.    push ax
  60. ;
  61.    cs:
  62.    mov ax,[107]    ;get display segment into es
  63.    mov es,ax
  64. ;
  65. ;----------------------------------------
  66. ; prepare display with blanks
  67. ;
  68.    mov ax,0f20     ;space with attribute of 15
  69.    es:
  70.    mov [94],ax
  71.    es:
  72.    mov [96],ax     ;set attribute of the function code locations
  73.    es:
  74.    mov [98],ax
  75. ;
  76. ;----------------------------------------
  77. ; display the rotating twiddle character
  78. ;
  79.    cs:
  80.    mov bx,[10e]    ;get twiddle index
  81.    inc bx
  82.    mov al,bl       ;advance to next twiddle position
  83.    and al,3        ;bx=bx mod 4 to rotate through twiddles
  84.    mov bl,al
  85.    cs:
  86.    mov [10e],bx    ;save next twiddle index
  87. ;
  88.    cs:
  89.    mov ah,[110+bx] ;get the next twiddle character
  90.    es:
  91.    mov [94],ah     ;put twiddle status on screen
  92. ;
  93. ;----------------------------------------
  94. ; display the DOS service number in hex
  95. ;
  96.    pop ax          ;get the dos function code into ah
  97.    push ax
  98. ;
  99.    and ah,0f
  100.    add ah,30       ;convert low digit to hex
  101. ;
  102.    cmp ah,3a       ;handle A..F
  103.    jb 1e8
  104.    add ah,7
  105.    jmp 1e8
  106.  
  107.  
  108. a1e8
  109.    es:
  110.    mov [98],ah     ;and set LSB on screen
  111. ;
  112.    pop ax          ;get fresh copy of function code into ah
  113.    push ax
  114. ;
  115.    shr ah,1        ;move down bits for high digit
  116.    shr ah,1
  117.    shr ah,1
  118.    shr ah,1        ;make high byte hex and put on screen
  119.    and ah,0f
  120.    add ah,30
  121. ;
  122.    cmp ah,3a       ;handle A..F
  123.    jb 218
  124.    add ah,7
  125.    jmp 218
  126.  
  127.  
  128. a218
  129.    es:
  130.    mov [96],ah     ;set MSB on screen
  131.    jmp 228
  132.  
  133.  
  134. a228
  135. ;----------------------------------------
  136. ; perform the DOS service function
  137. ;
  138.    pop ax
  139.    pop bx
  140.    pop es          ;restore initial entry registers
  141.    pop ds
  142. ;
  143.    cs:
  144.    jmp far [103]   ;jump to the real dos handler
  145.  
  146.  
  147. a2e0
  148. ;----------------------------------------
  149. ; startup code
  150. ;----------------------------------------
  151. ; determine where the video ram is.  this is done by putting a special
  152. ; character on the screen and then looking for it in the various video
  153. ; ram locations.
  154. ;
  155.    push cs
  156.    pop ds
  157. ;
  158.    mov ah,3         ;get cursor position
  159.    int 10           ;video bios service
  160.    push ax
  161.    push bx
  162.    push dx          ;save it for later
  163. ;
  164.    mov dx,0
  165.    mov ah,2         ;home the cursor
  166.    int 10
  167. ;
  168.    mov ah,0A
  169.    mov al,88        ;display a funny char at cursor
  170.    mov cx,1
  171.    int 10
  172. ;
  173. ; move cursor back to original position
  174. ;
  175.    pop dx
  176.    pop bx
  177.    pop ax
  178.    mov ah,2
  179.    int 10
  180. ;
  181. ; look for MONO video ram
  182. ;
  183.    mov dl,88
  184.    mov ax,b000
  185.    mov es,ax
  186.    es:
  187.    cmp dl,[0]
  188.    jz 360
  189. ;
  190. ; look for COLOR video ram
  191. ;
  192.    mov ax,b800
  193.    mov es,ax
  194.    es:
  195.    cmp dl,[0]
  196.    jz 360
  197. ;
  198. ; couldn't find video ram; display a message and abort
  199. ;
  200.    mov dx,308
  201.    mov ah,9
  202.    int 21           ;display error message
  203.    int 20           ;terminate program
  204.  
  205.  
  206. a328
  207.    db "ERROR: Can't find display memory$"
  208.  
  209.  
  210. a360
  211. ;
  212.    cs:
  213.    mov [107],ax     ;set the display segment
  214. ;
  215. ;----------------------------------------
  216. ; display the program signon message now that we are sure
  217. ; that we can be installed
  218. ;
  219.    mov dx,130
  220.    mov ah,9
  221.    int 21           ;display signon message
  222. ;
  223. ;----------------------------------------
  224. ; now install new interrupt handler
  225. ;
  226.    mov ax,0
  227.    mov es,ax
  228. ;
  229. ; save old DOS service vector
  230. ;
  231.    es:
  232.    mov ax,[84]
  233.    cs:
  234.    mov [103],ax
  235. ;
  236.    es:
  237.    mov ax,[86]
  238.    cs:
  239.    mov [105],ax
  240. ;
  241. ; install new vector
  242. ;
  243.    mov ax,170       ;entry point offset
  244.    es:
  245.    mov [84],ax
  246. ;
  247.    mov ax,cs        ;this code segment
  248.    es:
  249.    mov [86],ax
  250. ;
  251. ; set last resident code offset
  252. ; and terminate-and-stay-resident
  253. ;
  254.    mov al,0         ;exit code
  255.    mov dx,30        ;paragraphs to keep resident
  256.    mov ah,31        ;keep process function
  257.    int 21           ;terminate and stay in memory
  258.  
  259.  
  260. rcx
  261. 400
  262. ndosmon.com
  263. w
  264. q
  265.